import request from '@/utils/request'
//根据员工id查机构以及所以下属机构
export function info(userid) {
  return request({
    url: '/pd-auth/core_org/QueryCoreallShuZhi/' + userid,
    method: 'get',
    params: { userid: userid }
  })
}
// 根据员工id查机构
export function queryCoreByuserId(id) {
  return request({
    url: '/pd-auth/core_org/queryCoreByuserId/' +id,
    method: 'get',
    data: { id: id } // 携带具名的userid参数
  })
}
//添加机构
export function AddCore(coreOrg) {
  return request({
    url: '/pd-auth/core_org/AddCoreById/',
    method: 'post',
    data: coreOrg // 携带具名的userid参数
  })
}

//修改机构
export function UpdateCore(coreOrg) {
  return request({
    url: '/pd-auth/core_org/UpdateCoreById/',
    method: 'post',
    data:coreOrg
  })
}
//添加员工
export function AddEmpl(user) {
  return request({
    url: '/pd-auth/user/addUser/',
    method: 'post',
    data:user
  })
}

//根据机构id查员工
export function userByOrgId(postData) {

  return request({
    url: '/pd-auth/user/pageUser/' ,
    method: 'post',
    data: postData
  })
}

//根据机构id删除机构
export function DelCoreById(id) {
  return request({
    url: `/pd-auth/core_org/DelCoreById/${ id }`,
    method: 'get',
    params: { id }
  })
}


//根据员工id查角色
export function roleidbyUserId(userid) {
  return request({
    url: '/pd-auth/role/roleidbyUserId/' ,
    method: 'post',
    data: userid
  })
}


//查出所以角色
export function QueryRoleAll() {
  return request({
    url: '/pd-auth/role/QueryRoleAll/' ,
    method: 'post',

  })
}


//删除角色根据员工id
export function deleteUserRole(id) {
  return request({
    url: '/pd-auth/userRole/deleteUserRole/' +id,
    method: 'get',
    data: {id: id}
  })
}

//根据员工修改
export function UpdateEmplByid(user) {
  return request({
    url: '/pd-auth/user/updateUser/',
    method: 'post',
    data:user
  })
}


//删除员工
export function deleteUser(id) {
  return request({
    url: '/pd-auth/user/deleteUser/' +id,
    method: 'get',
    data: { id:id }
  })
}


//根据父id查子机构
export function queryByPerantId(parentId) {
  return request({
    url: '/pd-auth/core_org/queryByPerantId/' +parentId,
    method: 'get',
    params: parentId
  })
}


//根据机构id查岗位
export function stationByOrgId(orgId) {
  return request({
    url: '/pd-auth/station/stationByOrgId/' +orgId,
    method: 'get',
    params: {orgId:orgId}
  })
}


//给员工添加角色
export function addUserRole(userRole) {
  return request({
    url: '/pd-auth/userRole/addUserRole/',
    method: 'post',
    data: userRole
  })
}



